package Demo2;

import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-05-20
 * Time: 16:47
 */
public class Test {
    public void func(Animal animal){
        animal.eat();
    }

    public void wake(IRunning run_){
        run_.walk();
    }

    public void swim(ISwimming swim_){
        swim_.swim();
    }

    public void fly(IFly fly_){
        fly_.fly();
    }

    public static void main(String[] args) {
        Dog dog1 = new Dog("大黄",11);
        Dog dog2 = new Dog("大黄",11);

        System.out.println(dog1.equals(dog2));
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }

    public static void main2(String[] args) {
        Test t = new Test();
        t.fly(new Duck("唐老鸭",4));

        t.wake(new Dog("大黄",11));
        t.wake(new Duck("唐老鸭",9));

        t.swim(new Dog("大黄",10));
        t.swim(new Duck("唐老鸭",9));
        t.swim(new Fish("小鱼儿",9));


        t.wake(new robot());
    }
    public static void main1(String[] args) {
        Test test = new Test();
        test.func(new Dog("大黄",7));
        test.func(new Fish("小鱼儿",4));
        test.func(new Duck("唐老鸭",44));
    }
}
